package cn.rkylin.oms.item.adapter;

import cn.rkylin.core.IDataBaseFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Scope;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.Serializable;
import java.util.Map;

/**
 * Created by Administrator on 2018-1-18.
 */
@Service("vipItemAdapter")
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class VipItemAdapter extends ItemAdapter {

    private static final Log logger = LogFactory.getLog(XvpItemAdapter.class);

    @Resource(name = "redisTemplate")
    private RedisTemplate<Serializable, Serializable> redisTemplate;

    /**
     * 数据库访问对象
     */
    @Autowired
    private IDataBaseFactory dao;

    /**
     * 构造函数
     */
    public VipItemAdapter() {
    }

    @Override
    public int downloadByItemCode(String shopId, Map<String, Object> paramMap) {
        return 0;
    }

    @Override
    public int downloadByModifyTime(String shopId, Map<String, Object> paramMap) throws Exception {
        return 0;
    }

    @Override
    public int downloadAll(String shopId) {
        return 0;
    }

    /**
     * 自动同步店铺库存并上下架
     *
     * @param shopId
     * @return 错误消息
     * @throws Exception
     *             异常
     */
    @Override
    public String autoSynchStock(String shopId) throws Exception {
        return getItemVisitor().autoSynchStock(shopId);
    }

    /**
     * 手动同步库存根据商品
     *
     * @param ecItemId
     * @return 错误消息
     * @throws Exception
     *             异常
     */
    @Override
    public String manualSynchStockByItem(String ecItemId) throws Exception {
        return getItemVisitor().manualSynchStockByItem(ecItemId);
    }

    /**
     * 手动同步库存根据SKU
     *
     * @param ecSkuId
     * @return 错误消息
     * @throws Exception
     *             异常
     */
    @Override
    public String manualSynchStockBySku(String ecSkuId) throws Exception {
        return getItemVisitor().manualSynchStockBySku(ecSkuId);
    }


}
